extends Node2D


var gear_prototype;
var grab_prototype;
var gear_container;
var mech_container;
var grab_container;

var catched_gear = false;

func _ready():
	gear_prototype = get_node('Gear_container/gear').duplicate()
	grab_prototype = get_node('Mech_container/Grab_container/gear').duplicate()
	gear_container = get_node('Gear_container')
	mech_container = get_node('Mech_container')
	grab_container = get_node('Mech_container/Grab_container')
	
	#gear_prototype.get_parent().remove_child(gear_prototype)
	#var newgear = gear_prototype.duplicate()
	#gear_container.add_child(newgear)


func _process(delta):
	var debug = preload("res://scripts/main/debug.gd");
	debug.mouseMove_gear(self, delta);
	calc_gear_spd(delta);

func calc_gear_spd(_delta):
	var _gearList = gear_container.get_children();
	#var distanceMap = generateDistanceMap();

func is_gear_collided(gear1, gear2):
	var p1 = gear1.position;
	var r1 = gear1.gear_radius;
	var p2 = gear2.position;
	var r2 = gear2.gear_radius;
	return p1.distance_to(p2) < (r1 + r2);
